/**
 * 
 */
package com.hereway.core.servlet;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.context.support.SpringBeanAutowiringSupport;

/**
 * @author kevin
 *
 */
public class BaseServlet extends HttpServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void init(ServletConfig config) throws ServletException {
		SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
		super.init(config);
	}
	
	protected void writeResponse(HttpServletResponse response, Object value){
		response.setContentType("text/html;charset=UTF-8");
		try {
			response.getWriter().print(value);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
